﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<script>

    $(function () {
        var mydate = new Date();
        $("#end").val(formatDate(mydate));
        mydate.setDate(mydate.getDate());
        $("#start").val(formatDate(mydate));

        gridList();
    });
    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/SystemManage/SysProgramLog/GetGridPaginationJson",
            postData: { start: $("#start").val(), end: $("#end").val() },
            height: $(window).height() - 120,
            colModel: [
                //{ label: 'Id', name: 'Id', width: 100, align: 'left' },
                { label: '时间', name: 'Date', width: 120, align: 'left' },
                { label: '线程ID', name: 'Thread', width: 100, align: 'left' },
                { label: '等级', name: 'Level', width: 100, align: 'left' },
                { label: '出错类', name: 'Logger', width: 100, align: 'left' },
                //{ label: '错误描述', name: 'Message', width: 100, align: 'left' },
                //{ label: '错误', name: 'Exception', width: 100, align: 'left' },

				{ label: "主键", name: "Id", hidden: true, key: true }
            ],
            pager: "#gridPager",
            sortname: 'Id desc',
            rowNum: 20,
            rowList: [20, 50, 100,200],
            viewrecords: true
        });
        $("#btn_search").click(function () {
            $gridList.jqGrid('setGridParam', {
                postData: { start: $("#start").val(), end: $("#end").val() }
            }).trigger('reloadGrid');
        });
    }
 
function btn_details() {
    var keyValue = $("#gridList").jqGridRowValue().Id;
     if (keyValue === undefined) {
        layer.msg('请选中行');
    } else {
		$.modalOpen({
			id: "Details",
			title: "查看程序日志",
			url: "/SystemManage/SysProgramLog/Details?keyValue=" + keyValue,
			width: "660px",
			height: "768px",
			btn: null
		});
	}
}
</script>
<div class="topPanel">
    <div class="toolbar">
        @*<div class="btn-group">
            <a id="NF-add" class="btn btn-primary dropdown-text" onclick="btn_add()"><i class="fa fa-plus"></i>新建</a>
        </div>*@
        <div class="operate">
            <ul class="nav nav-pills">
                <li class="first">已选中<span>1</span>项</li>
                @*<li><a id="NF-edit" authorize="yes" onclick="btn_edit()"><i class="fa fa-pencil-square-o"></i>修改</a></li>
                <li><a id="NF-delete" authorize="yes" onclick="btn_delete()"><i class="fa fa-trash-o"></i>删除</a></li>*@
                <li><a id="NF-Details" authorize="yes" onclick="btn_details()"><i class="fa fa-search-plus"></i>查看</a></li>
            </ul>
            <a href="javascript:;" class="close"></a>
        </div>
        <script>$('.toolbar').authorizeButton()</script>
    </div>
    <div class="search">
        <table>
            <tbody>
                <tr>
                    <td>


                        <div id="txt_condition" class="btn-group">
                            <a class="btn btn-default dropdown-text" data-toggle="dropdown">选择条件</a>
                            <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
                            <ul class="dropdown-menu">
                                @*<li><a href="javascript:void()" data-value="DbName">选择条件</a></li>
                                <li><a href="javascript:void()" data-value="DbName">错误</a></li>
                                <li><a href="javascript:void()" data-value="FileName">调试</a></li>
                                <li><a href="javascript:void()" data-value="FileName">警告</a></li>*@
                            </ul>
                        </div>
                    </td>
                    <td style="padding-left: 10px;">
                        <div class="input-group">
                            <input class="form-control" id="start" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" placeholder="开始时间" style=" width:100px" type="text">
                        </div>
                    </td>
                    <td style="padding-left: 10px;">
                        <div class="input-group">
                            <input class="form-control" id="end" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" placeholder="结束时间" style=" width:100px" type="text">
                        </div>
                    </td>
                    <td style="padding-left: 10px;">
                        <div class="input-group">
                            <span class="input-group-btn">
                                <button id="btn_search" type="button" class="btn  btn-primary"><i class="fa fa-search"></i></button>
                            </span>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>

    </div>
</div>
<div class="gridPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>




